%
% cc_interp1.m
%
%  Form the 1D linear interpolation matrix for a cell centered grid
%   with periodic boundary condtions.
%
% input -- Nf = number of cell centers on the fine grid
% output -- 
%
function Ip = cc_interp1(Nf)

if Nf==2
    Ip = cc_nm_interp1_const(Nf);
    return;
end

% number of centers on the coarse grid
%
Nc = Nf/2;

% allocate space for the matrix
%
Ip = spalloc(Nf,Nc,4*Nc);

% loop over columns
%
for j=1:Nc
    if j==1
        Irange = [Nf,1:3];
    elseif j==Nc
        Irange = [Nf-2:Nf,1];
    else
        Irange = [2*j-2:2*j+1];
    end
    Ip(Irange,j) = [0.25; 0.75; 0.75; 0.25];
end